/* Khazad Cipher
Copyright (C) Paulo S. L. M. Barreto.
Copyright (C) Vincent Rijmen.
Copyright (C) 2004 Aaron Grothe.
Copyright (C) 2011-2018 Manuel Sainz de Baranda y Goñi.
Released under the terms of the GNU Lesser General Public License v3. */

#if defined(CIPHER_KHAZAD_HIDE_API)
#	define CIPHER_KHAZAD_API static
#elif defined(CIPHER_KHAZAD_STATIC)
#	define CIPHER_KHAZAD_API
#else
#	define CIPHER_KHAZAD_API Z_API_EXPORT
#endif

#if defined(CIPHER_KHAZAD_HIDE_ABI)
#	define CIPHER_KHAZAD_ABI static
#elif defined(CIPHER_KHAZAD_STATIC)
#	define CIPHER_KHAZAD_ABI
#else
#	define CIPHER_KHAZAD_ABI Z_API_EXPORT
#endif

#define CIPHER_KHAZAD_OMIT_FUNCTION_PROTOTYPES

#if defined(CIPHER_KHAZAD_USE_LOCAL_HEADER)
#	include "Khazad.h"
#else
#	include <cipher/Khazad.h>
#endif

#include <Z/functions/base/value.h>

#define C(value) Z_UINT64(0x##value)

static zuint64 const t0[256] = {
	C(BAD3D268BBB96A01), C(54FC4D19E59A66B1), C(2F71BC93E26514CD), C(749CCDB925871B51),
	C(53F55102F7A257A4), C(D3686BB8D0D6BE03), C(D26B6FBDD6DEB504), C(4DD72964B35285FE),
	C(50F05D0DFDBA4AAD), C(ACE98A26CF09E063), C(8D8A0E83091C9684), C(BFDCC679A5914D1A),
	C(7090DDAD3DA7374D), C(52F65507F1AA5CA3), C(9AB352C87BA417E1), C(4CD42D61B55A8EF9),
	C(EA238F65460320AC), C(D56273A6C4E68411), C(97A466F155CC68C2), C(D16E63B2DCC6A80D),
	C(3355CCFFAA85D099), C(51F35908FBB241AA), C(5BED712AC7E20F9C), C(A6F7A204F359AE55),
	C(DE7F5F81FEBEC120), C(48D83D75AD7AA2E5), C(A8E59A32D729CC7F), C(99B65EC771BC0AE8),
	C(DB704B90E096E63B), C(3256C8FAAC8DDB9E), C(B7C4E65195D11522), C(FC19D72B32B3AACE),
	C(E338AB48704B7393), C(9EBF42DC63843BFD), C(91AE7EEF41FC52D0), C(9BB056CD7DAC1CE6),
	C(E23BAF4D76437894), C(BBD0D66DBDB16106), C(41C319589B32F1DA), C(6EB2A5CB7957E517),
	C(A5F2AE0BF941B35C), C(CB400BC08016564B), C(6BBDB1DA677FC20C), C(95A26EFB59DC7ECC),
	C(A1FEBE1FE1619F40), C(F308EB1810CBC3E3), C(B1CEFE4F81E12F30), C(0206080A0C10160E),
	C(CC4917DB922E675E), C(C45137F3A26E3F66), C(1D2774694EE8CF53), C(143C504478A09C6C),
	C(C3582BE8B0560E73), C(63A591F2573F9A34), C(DA734F95E69EED3C), C(5DE76934D3D2358E),
	C(5FE1613EDFC22380), C(DC79578BF2AED72E), C(7D87E99413CF486E), C(CD4A13DE94266C59),
	C(7F81E19E1FDF5E60), C(5AEE752FC1EA049B), C(6CB4ADC17547F319), C(5CE46D31D5DA3E89),
	C(F704FB0C08EBEFFF), C(266A98BED42D47F2), C(FF1CDB2438ABB7C7), C(ED2A937E543B11B9),
	C(E825876F4A1336A2), C(9DBA4ED3699C26F4), C(6FB1A1CE7F5FEE10), C(8E8F028C03048B8D),
	C(192B647D56C8E34F), C(A0FDBA1AE7699447), C(F00DE7171AD3DEEA), C(89861E97113CBA98),
	C(0F113C332278692D), C(07091C1B12383115), C(AFEC8629C511FD6A), C(FB10CB30208B9BDB),
	C(0818202830405838), C(153F54417EA8976B), C(0D1734392E687F23), C(040C101418202C1C),
	C(0103040506080B07), C(64AC8DE94507AB21), C(DF7C5B84F8B6CA27), C(769AC5B329970D5F),
	C(798BF9800BEF6472), C(DD7A538EF4A6DC29), C(3D47F4C98EF5B2B3), C(163A584E74B08A62),
	C(3F41FCC382E5A4BD), C(3759DCEBB2A5FC85), C(6DB7A9C4734FF81E), C(3848E0D890DD95A8),
	C(B9D6DE67B1A17708), C(7395D1A237BF2A44), C(E926836A4C1B3DA5), C(355FD4E1BEB5EA8B),
	C(55FF491CE3926DB6), C(7193D9A83BAF3C4A), C(7B8DF18A07FF727C), C(8C890A860F149D83),
	C(7296D5A731B72143), C(88851A921734B19F), C(F607FF090EE3E4F8), C(2A7EA882FC4D33D6),
	C(3E42F8C684EDAFBA), C(5EE2653BD9CA2887), C(27699CBBD2254CF5), C(46CA0543890AC0CF),
	C(0C14303C28607424), C(65AF89EC430FA026), C(68B8BDD56D67DF05), C(61A399F85B2F8C3A),
	C(03050C0F0A181D09), C(C15E23E2BC46187D), C(57F94116EF827BB8), C(D6677FA9CEFE9918),
	C(D976439AEC86F035), C(58E87D25CDFA1295), C(D875479FEA8EFB32), C(66AA85E34917BD2F),
	C(D7647BACC8F6921F), C(3A4EE8D29CCD83A6), C(C84507CF8A0E4B42), C(3C44F0CC88FDB9B4),
	C(FA13CF35268390DC), C(96A762F453C463C5), C(A7F4A601F551A552), C(98B55AC277B401EF),
	C(EC29977B52331ABE), C(B8D5DA62B7A97C0F), C(C7543BFCA876226F), C(AEEF822CC319F66D),
	C(69BBB9D06B6FD402), C(4BDD317AA762BFEC), C(ABE0963DDD31D176), C(A9E69E37D121C778),
	C(67A981E64F1FB628), C(0A1E28223C504E36), C(47C901468F02CBC8), C(F20BEF1D16C3C8E4),
	C(B5C2EE5B99C1032C), C(226688AACC0D6BEE), C(E532B356647B4981), C(EE2F9F715E230CB0),
	C(BEDFC27CA399461D), C(2B7DAC87FA4538D1), C(819E3EBF217CE2A0), C(1236485A6C90A67E),
	C(839836B52D6CF4AE), C(1B2D6C775AD8F541), C(0E1238362470622A), C(23658CAFCA0560E9),
	C(F502F30604FBF9F1), C(45CF094C8312DDC6), C(216384A5C61576E7), C(CE4F1FD19E3E7150),
	C(49DB3970AB72A9E2), C(2C74B09CE87D09C4), C(F916C33A2C9B8DD5), C(E637BF596E635488),
	C(B6C7E25493D91E25), C(2878A088F05D25D8), C(17395C4B72B88165), C(829B32B02B64FFA9),
	C(1A2E68725CD0FE46), C(8B80169D1D2CAC96), C(FE1FDF213EA3BCC0), C(8A8312981B24A791),
	C(091B242D3648533F), C(C94603CA8C064045), C(879426A1354CD8B2), C(4ED2256BB94A98F7),
	C(E13EA3427C5B659D), C(2E72B896E46D1FCA), C(E431B75362734286), C(E03DA7477A536E9A),
	C(EB208B60400B2BAB), C(90AD7AEA47F459D7), C(A4F1AA0EFF49B85B), C(1E22786644F0D25A),
	C(85922EAB395CCEBC), C(60A09DFD5D27873D), C(0000000000000000), C(256F94B1DE355AFB),
	C(F401F70302F3F2F6), C(F10EE3121CDBD5ED), C(94A16AFE5FD475CB), C(0B1D2C273A584531),
	C(E734BB5C686B5F8F), C(759FC9BC238F1056), C(EF2C9B74582B07B7), C(345CD0E4B8BDE18C),
	C(3153C4F5A695C697), C(D46177A3C2EE8F16), C(D06D67B7DACEA30A), C(869722A43344D3B5),
	C(7E82E59B19D75567), C(ADEA8E23C901EB64), C(FD1AD32E34BBA1C9), C(297BA48DF6552EDF),
	C(3050C0F0A09DCD90), C(3B4DECD79AC588A1), C(9FBC46D9658C30FA), C(F815C73F2A9386D2),
	C(C6573FF9AE7E2968), C(13354C5F6A98AD79), C(060A181E14303A12), C(050F14111E28271B),
	C(C55233F6A4663461), C(113344556688BB77), C(7799C1B62F9F0658), C(7C84ED9115C74369),
	C(7A8EF58F01F7797B), C(7888FD850DE76F75), C(365AD8EEB4ADF782), C(1C24706C48E0C454),
	C(394BE4DD96D59EAF), C(59EB7920CBF21992), C(1828607850C0E848), C(56FA4513E98A70BF),
	C(B3C8F6458DF1393E), C(B0CDFA4A87E92437), C(246C90B4D83D51FC), C(206080A0C01D7DE0),
	C(B2CBF2408BF93239), C(92AB72E04BE44FD9), C(A3F8B615ED71894E), C(C05D27E7BA4E137A),
	C(44CC0D49851AD6C1), C(62A695F751379133), C(103040506080B070), C(B4C1EA5E9FC9082B),
	C(84912AAE3F54C5BB), C(43C511529722E7D4), C(93A876E54DEC44DE), C(C25B2FEDB65E0574),
	C(4ADE357FA16AB4EB), C(BDDACE73A9815B14), C(8F8C0689050C808A), C(2D77B499EE7502C3),
	C(BCD9CA76AF895013), C(9CB94AD66F942DF3), C(6ABEB5DF6177C90B), C(40C01D5D9D3AFADD),
	C(CF4C1BD498367A57), C(A2FBB210EB798249), C(809D3ABA2774E9A7), C(4FD1216EBF4293F0),
	C(1F217C6342F8D95D), C(CA430FC5861E5D4C), C(AAE39238DB39DA71), C(42C61557912AECD3)
};

static zuint64 const t1[256] = {
	C(D3BA68D2B9BB016A), C(FC54194D9AE5B166), C(712F93BC65E2CD14), C(9C74B9CD8725511B),
	C(F5530251A2F7A457), C(68D3B86BD6D003BE), C(6BD2BD6FDED604B5), C(D74D642952B3FE85),
	C(F0500D5DBAFDAD4A), C(E9AC268A09CF63E0), C(8A8D830E1C098496), C(DCBF79C691A51A4D),
	C(9070ADDDA73D4D37), C(F6520755AAF1A35C), C(B39AC852A47BE117), C(D44C612D5AB5F98E),
	C(23EA658F0346AC20), C(62D5A673E6C41184), C(A497F166CC55C268), C(6ED1B263C6DC0DA8),
	C(5533FFCC85AA99D0), C(F3510859B2FBAA41), C(ED5B2A71E2C79C0F), C(F7A604A259F355AE),
	C(7FDE815FBEFE20C1), C(D848753D7AADE5A2), C(E5A8329A29D77FCC), C(B699C75EBC71E80A),
	C(70DB904B96E03BE6), C(5632FAC88DAC9EDB), C(C4B751E6D1952215), C(19FC2BD7B332CEAA),
	C(38E348AB4B709373), C(BF9EDC428463FD3B), C(AE91EF7EFC41D052), C(B09BCD56AC7DE61C),
	C(3BE24DAF43769478), C(D0BB6DD6B1BD0661), C(C3415819329BDAF1), C(B26ECBA5577917E5),
	C(F2A50BAE41F95CB3), C(40CBC00B16804B56), C(BD6BDAB17F670CC2), C(A295FB6EDC59CC7E),
	C(FEA11FBE61E1409F), C(08F318EBCB10E3C3), C(CEB14FFEE181302F), C(06020A08100C0E16),
	C(49CCDB172E925E67), C(51C4F3376EA2663F), C(271D6974E84E53CF), C(3C144450A0786C9C),
	C(58C3E82B56B0730E), C(A563F2913F57349A), C(73DA954F9EE63CED), C(E75D3469D2D38E35),
	C(E15F3E61C2DF8023), C(79DC8B57AEF22ED7), C(877D94E9CF136E48), C(4ACDDE132694596C),
	C(817F9EE1DF1F605E), C(EE5A2F75EAC19B04), C(B46CC1AD477519F3), C(E45C316DDAD5893E),
	C(04F70CFBEB08FFEF), C(6A26BE982DD4F247), C(1CFF24DBAB38C7B7), C(2AED7E933B54B911),
	C(25E86F87134AA236), C(BA9DD34E9C69F426), C(B16FCEA15F7F10EE), C(8F8E8C0204038D8B),
	C(2B197D64C8564FE3), C(FDA01ABA69E74794), C(0DF017E7D31AEADE), C(8689971E3C1198BA),
	C(110F333C78222D69), C(09071B1C38121531), C(ECAF298611C56AFD), C(10FB30CB8B20DB9B),
	C(1808282040303858), C(3F154154A87E6B97), C(170D3934682E237F), C(0C04141020181C2C),
	C(030105040806070B), C(AC64E98D074521AB), C(7CDF845BB6F827CA), C(9A76B3C597295F0D),
	C(8B7980F9EF0B7264), C(7ADD8E53A6F429DC), C(473DC9F4F58EB3B2), C(3A164E58B074628A),
	C(413FC3FCE582BDA4), C(5937EBDCA5B285FC), C(B76DC4A94F731EF8), C(4838D8E0DD90A895),
	C(D6B967DEA1B10877), C(9573A2D1BF37442A), C(26E96A831B4CA53D), C(5F35E1D4B5BE8BEA),
	C(FF551C4992E3B66D), C(9371A8D9AF3B4A3C), C(8D7B8AF1FF077C72), C(898C860A140F839D),
	C(9672A7D5B7314321), C(8588921A34179FB1), C(07F609FFE30EF8E4), C(7E2A82A84DFCD633),
	C(423EC6F8ED84BAAF), C(E25E3B65CAD98728), C(6927BB9C25D2F54C), C(CA4643050A89CFC0),
	C(140C3C3060282474), C(AF65EC890F4326A0), C(B868D5BD676D05DF), C(A361F8992F5B3A8C),
	C(05030F0C180A091D), C(5EC1E22346BC7D18), C(F957164182EFB87B), C(67D6A97FFECE1899),
	C(76D99A4386EC35F0), C(E858257DFACD9512), C(75D89F478EEA32FB), C(AA66E38517492FBD),
	C(64D7AC7BF6C81F92), C(4E3AD2E8CD9CA683), C(45C8CF070E8A424B), C(443CCCF0FD88B4B9),
	C(13FA35CF8326DC90), C(A796F462C453C563), C(F4A701A651F552A5), C(B598C25AB477EF01),
	C(29EC7B973352BE1A), C(D5B862DAA9B70F7C), C(54C7FC3B76A86F22), C(EFAE2C8219C36DF6),
	C(BB69D0B96F6B02D4), C(DD4B7A3162A7ECBF), C(E0AB3D9631DD76D1), C(E6A9379E21D178C7),
	C(A967E6811F4F28B6), C(1E0A2228503C364E), C(C9474601028FC8CB), C(0BF21DEFC316E4C8),
	C(C2B55BEEC1992C03), C(6622AA880DCCEE6B), C(32E556B37B648149), C(2FEE719F235EB00C),
	C(DFBE7CC299A31D46), C(7D2B87AC45FAD138), C(9E81BF3E7C21A0E2), C(36125A48906C7EA6),
	C(9883B5366C2DAEF4), C(2D1B776CD85A41F5), C(120E363870242A62), C(6523AF8C05CAE960),
	C(02F506F3FB04F1F9), C(CF454C091283C6DD), C(6321A58415C6E776), C(4FCED11F3E9E5071),
	C(DB49703972ABE2A9), C(742C9CB07DE8C409), C(16F93AC39B2CD58D), C(37E659BF636E8854),
	C(C7B654E2D993251E), C(782888A05DF0D825), C(39174B5CB8726581), C(9B82B032642BA9FF),
	C(2E1A7268D05C46FE), C(808B9D162C1D96AC), C(1FFE21DFA33EC0BC), C(838A9812241B91A7),
	C(1B092D2448363F53), C(46C9CA03068C4540), C(9487A1264C35B2D8), C(D24E6B254AB9F798),
	C(3EE142A35B7C9D65), C(722E96B86DE4CA1F), C(31E453B773628642), C(3DE047A7537A9A6E),
	C(20EB608B0B40AB2B), C(AD90EA7AF447D759), C(F1A40EAA49FF5BB8), C(221E6678F0445AD2),
	C(9285AB2E5C39BCCE), C(A060FD9D275D3D87), C(0000000000000000), C(6F25B19435DEFB5A),
	C(01F403F7F302F6F2), C(0EF112E3DB1CEDD5), C(A194FE6AD45FCB75), C(1D0B272C583A3145),
	C(34E75CBB6B688F5F), C(9F75BCC98F235610), C(2CEF749B2B58B707), C(5C34E4D0BDB88CE1),
	C(5331F5C495A697C6), C(61D4A377EEC2168F), C(6DD0B767CEDA0AA3), C(9786A4224433B5D3),
	C(827E9BE5D7196755), C(EAAD238E01C964EB), C(1AFD2ED3BB34C9A1), C(7B298DA455F6DF2E),
	C(5030F0C09DA090CD), C(4D3BD7ECC59AA188), C(BC9FD9468C65FA30), C(15F83FC7932AD286),
	C(57C6F93F7EAE6829), C(35135F4C986A79AD), C(0A061E183014123A), C(0F051114281E1B27),
	C(52C5F63366A46134), C(33115544886677BB), C(9977B6C19F2F5806), C(847C91EDC7156943),
	C(8E7A8FF5F7017B79), C(887885FDE70D756F), C(5A36EED8ADB482F7), C(241C6C70E04854C4),
	C(4B39DDE4D596AF9E), C(EB592079F2CB9219), C(28187860C05048E8), C(FA5613458AE9BF70),
	C(C8B345F6F18D3E39), C(CDB04AFAE9873724), C(6C24B4903DD8FC51), C(6020A0801DC0E07D),
	C(CBB240F2F98B3932), C(AB92E072E44BD94F), C(F8A315B671ED4E89), C(5DC0E7274EBA7A13),
	C(CC44490D1A85C1D6), C(A662F79537513391), C(30105040806070B0), C(C1B45EEAC99F2B08),
	C(9184AE2A543FBBC5), C(C54352112297D4E7), C(A893E576EC4DDE44), C(5BC2ED2F5EB67405),
	C(DE4A7F356AA1EBB4), C(DABD73CE81A9145B), C(8C8F89060C058A80), C(772D99B475EEC302),
	C(D9BC76CA89AF1350), C(B99CD64A946FF32D), C(BE6ADFB577610BC9), C(C0405D1D3A9DDDFA),
	C(4CCFD41B3698577A), C(FBA210B279EB4982), C(9D80BA3A7427A7E9), C(D14F6E2142BFF093),
	C(211F637CF8425DD9), C(43CAC50F1E864C5D), C(E3AA389239DB71DA), C(C64257152A91D3EC)
};

static zuint64 const t2[256] = {
	C(D268BAD36A01BBB9), C(4D1954FC66B1E59A), C(BC932F7114CDE265), C(CDB9749C1B512587),
	C(510253F557A4F7A2), C(6BB8D368BE03D0D6), C(6FBDD26BB504D6DE), C(29644DD785FEB352),
	C(5D0D50F04AADFDBA), C(8A26ACE9E063CF09), C(0E838D8A9684091C), C(C679BFDC4D1AA591),
	C(DDAD7090374D3DA7), C(550752F65CA3F1AA), C(52C89AB317E17BA4), C(2D614CD48EF9B55A),
	C(8F65EA2320AC4603), C(73A6D5628411C4E6), C(66F197A468C255CC), C(63B2D16EA80DDCC6),
	C(CCFF3355D099AA85), C(590851F341AAFBB2), C(712A5BED0F9CC7E2), C(A204A6F7AE55F359),
	C(5F81DE7FC120FEBE), C(3D7548D8A2E5AD7A), C(9A32A8E5CC7FD729), C(5EC799B60AE871BC),
	C(4B90DB70E63BE096), C(C8FA3256DB9EAC8D), C(E651B7C4152295D1), C(D72BFC19AACE32B3),
	C(AB48E3387393704B), C(42DC9EBF3BFD6384), C(7EEF91AE52D041FC), C(56CD9BB01CE67DAC),
	C(AF4DE23B78947643), C(D66DBBD06106BDB1), C(195841C3F1DA9B32), C(A5CB6EB2E5177957),
	C(AE0BA5F2B35CF941), C(0BC0CB40564B8016), C(B1DA6BBDC20C677F), C(6EFB95A27ECC59DC),
	C(BE1FA1FE9F40E161), C(EB18F308C3E310CB), C(FE4FB1CE2F3081E1), C(080A0206160E0C10),
	C(17DBCC49675E922E), C(37F3C4513F66A26E), C(74691D27CF534EE8), C(5044143C9C6C78A0),
	C(2BE8C3580E73B056), C(91F263A59A34573F), C(4F95DA73ED3CE69E), C(69345DE7358ED3D2),
	C(613E5FE12380DFC2), C(578BDC79D72EF2AE), C(E9947D87486E13CF), C(13DECD4A6C599426),
	C(E19E7F815E601FDF), C(752F5AEE049BC1EA), C(ADC16CB4F3197547), C(6D315CE43E89D5DA),
	C(FB0CF704EFFF08EB), C(98BE266A47F2D42D), C(DB24FF1CB7C738AB), C(937EED2A11B9543B),
	C(876FE82536A24A13), C(4ED39DBA26F4699C), C(A1CE6FB1EE107F5F), C(028C8E8F8B8D0304),
	C(647D192BE34F56C8), C(BA1AA0FD9447E769), C(E717F00DDEEA1AD3), C(1E978986BA98113C),
	C(3C330F11692D2278), C(1C1B070931151238), C(8629AFECFD6AC511), C(CB30FB109BDB208B),
	C(2028081858383040), C(5441153F976B7EA8), C(34390D177F232E68), C(1014040C2C1C1820),
	C(040501030B070608), C(8DE964ACAB214507), C(5B84DF7CCA27F8B6), C(C5B3769A0D5F2997),
	C(F980798B64720BEF), C(538EDD7ADC29F4A6), C(F4C93D47B2B38EF5), C(584E163A8A6274B0),
	C(FCC33F41A4BD82E5), C(DCEB3759FC85B2A5), C(A9C46DB7F81E734F), C(E0D8384895A890DD),
	C(DE67B9D67708B1A1), C(D1A273952A4437BF), C(836AE9263DA54C1B), C(D4E1355FEA8BBEB5),
	C(491C55FF6DB6E392), C(D9A871933C4A3BAF), C(F18A7B8D727C07FF), C(0A868C899D830F14),
	C(D5A77296214331B7), C(1A928885B19F1734), C(FF09F607E4F80EE3), C(A8822A7E33D6FC4D),
	C(F8C63E42AFBA84ED), C(653B5EE22887D9CA), C(9CBB27694CF5D225), C(054346CAC0CF890A),
	C(303C0C1474242860), C(89EC65AFA026430F), C(BDD568B8DF056D67), C(99F861A38C3A5B2F),
	C(0C0F03051D090A18), C(23E2C15E187DBC46), C(411657F97BB8EF82), C(7FA9D6679918CEFE),
	C(439AD976F035EC86), C(7D2558E81295CDFA), C(479FD875FB32EA8E), C(85E366AABD2F4917),
	C(7BACD764921FC8F6), C(E8D23A4E83A69CCD), C(07CFC8454B428A0E), C(F0CC3C44B9B488FD),
	C(CF35FA1390DC2683), C(62F496A763C553C4), C(A601A7F4A552F551), C(5AC298B501EF77B4),
	C(977BEC291ABE5233), C(DA62B8D57C0FB7A9), C(3BFCC754226FA876), C(822CAEEFF66DC319),
	C(B9D069BBD4026B6F), C(317A4BDDBFECA762), C(963DABE0D176DD31), C(9E37A9E6C778D121),
	C(81E667A9B6284F1F), C(28220A1E4E363C50), C(014647C9CBC88F02), C(EF1DF20BC8E416C3),
	C(EE5BB5C2032C99C1), C(88AA22666BEECC0D), C(B356E5324981647B), C(9F71EE2F0CB05E23),
	C(C27CBEDF461DA399), C(AC872B7D38D1FA45), C(3EBF819EE2A0217C), C(485A1236A67E6C90),
	C(36B58398F4AE2D6C), C(6C771B2DF5415AD8), C(38360E12622A2470), C(8CAF236560E9CA05),
	C(F306F502F9F104FB), C(094C45CFDDC68312), C(84A5216376E7C615), C(1FD1CE4F71509E3E),
	C(397049DBA9E2AB72), C(B09C2C7409C4E87D), C(C33AF9168DD52C9B), C(BF59E63754886E63),
	C(E254B6C71E2593D9), C(A088287825D8F05D), C(5C4B1739816572B8), C(32B0829BFFA92B64),
	C(68721A2EFE465CD0), C(169D8B80AC961D2C), C(DF21FE1FBCC03EA3), C(12988A83A7911B24),
	C(242D091B533F3648), C(03CAC94640458C06), C(26A18794D8B2354C), C(256B4ED298F7B94A),
	C(A342E13E659D7C5B), C(B8962E721FCAE46D), C(B753E43142866273), C(A747E03D6E9A7A53),
	C(8B60EB202BAB400B), C(7AEA90AD59D747F4), C(AA0EA4F1B85BFF49), C(78661E22D25A44F0),
	C(2EAB8592CEBC395C), C(9DFD60A0873D5D27), C(0000000000000000), C(94B1256F5AFBDE35),
	C(F703F401F2F602F3), C(E312F10ED5ED1CDB), C(6AFE94A175CB5FD4), C(2C270B1D45313A58),
	C(BB5CE7345F8F686B), C(C9BC759F1056238F), C(9B74EF2C07B7582B), C(D0E4345CE18CB8BD),
	C(C4F53153C697A695), C(77A3D4618F16C2EE), C(67B7D06DA30ADACE), C(22A48697D3B53344),
	C(E59B7E82556719D7), C(8E23ADEAEB64C901), C(D32EFD1AA1C934BB), C(A48D297B2EDFF655),
	C(C0F03050CD90A09D), C(ECD73B4D88A19AC5), C(46D99FBC30FA658C), C(C73FF81586D22A93),
	C(3FF9C6572968AE7E), C(4C5F1335AD796A98), C(181E060A3A121430), C(1411050F271B1E28),
	C(33F6C5523461A466), C(44551133BB776688), C(C1B6779906582F9F), C(ED917C84436915C7),
	C(F58F7A8E797B01F7), C(FD8578886F750DE7), C(D8EE365AF782B4AD), C(706C1C24C45448E0),
	C(E4DD394B9EAF96D5), C(792059EB1992CBF2), C(60781828E84850C0), C(451356FA70BFE98A),
	C(F645B3C8393E8DF1), C(FA4AB0CD243787E9), C(90B4246C51FCD83D), C(80A020607DE0C01D),
	C(F240B2CB32398BF9), C(72E092AB4FD94BE4), C(B615A3F8894EED71), C(27E7C05D137ABA4E),
	C(0D4944CCD6C1851A), C(95F762A691335137), C(40501030B0706080), C(EA5EB4C1082B9FC9),
	C(2AAE8491C5BB3F54), C(115243C5E7D49722), C(76E593A844DE4DEC), C(2FEDC25B0574B65E),
	C(357F4ADEB4EBA16A), C(CE73BDDA5B14A981), C(06898F8C808A050C), C(B4992D7702C3EE75),
	C(CA76BCD95013AF89), C(4AD69CB92DF36F94), C(B5DF6ABEC90B6177), C(1D5D40C0FADD9D3A),
	C(1BD4CF4C7A579836), C(B210A2FB8249EB79), C(3ABA809DE9A72774), C(216E4FD193F0BF42),
	C(7C631F21D95D42F8), C(0FC5CA435D4C861E), C(9238AAE3DA71DB39), C(155742C6ECD3912A)
};

static zuint64 const t3[256] = {
	C(68D2D3BA016AB9BB), C(194DFC54B1669AE5), C(93BC712FCD1465E2), C(B9CD9C74511B8725),
	C(0251F553A457A2F7), C(B86B68D303BED6D0), C(BD6F6BD204B5DED6), C(6429D74DFE8552B3),
	C(0D5DF050AD4ABAFD), C(268AE9AC63E009CF), C(830E8A8D84961C09), C(79C6DCBF1A4D91A5),
	C(ADDD90704D37A73D), C(0755F652A35CAAF1), C(C852B39AE117A47B), C(612DD44CF98E5AB5),
	C(658F23EAAC200346), C(A67362D51184E6C4), C(F166A497C268CC55), C(B2636ED10DA8C6DC),
	C(FFCC553399D085AA), C(0859F351AA41B2FB), C(2A71ED5B9C0FE2C7), C(04A2F7A655AE59F3),
	C(815F7FDE20C1BEFE), C(753DD848E5A27AAD), C(329AE5A87FCC29D7), C(C75EB699E80ABC71),
	C(904B70DB3BE696E0), C(FAC856329EDB8DAC), C(51E6C4B72215D195), C(2BD719FCCEAAB332),
	C(48AB38E393734B70), C(DC42BF9EFD3B8463), C(EF7EAE91D052FC41), C(CD56B09BE61CAC7D),
	C(4DAF3BE294784376), C(6DD6D0BB0661B1BD), C(5819C341DAF1329B), C(CBA5B26E17E55779),
	C(0BAEF2A55CB341F9), C(C00B40CB4B561680), C(DAB1BD6B0CC27F67), C(FB6EA295CC7EDC59),
	C(1FBEFEA1409F61E1), C(18EB08F3E3C3CB10), C(4FFECEB1302FE181), C(0A0806020E16100C),
	C(DB1749CC5E672E92), C(F33751C4663F6EA2), C(6974271D53CFE84E), C(44503C146C9CA078),
	C(E82B58C3730E56B0), C(F291A563349A3F57), C(954F73DA3CED9EE6), C(3469E75D8E35D2D3),
	C(3E61E15F8023C2DF), C(8B5779DC2ED7AEF2), C(94E9877D6E48CF13), C(DE134ACD596C2694),
	C(9EE1817F605EDF1F), C(2F75EE5A9B04EAC1), C(C1ADB46C19F34775), C(316DE45C893EDAD5),
	C(0CFB04F7FFEFEB08), C(BE986A26F2472DD4), C(24DB1CFFC7B7AB38), C(7E932AEDB9113B54),
	C(6F8725E8A236134A), C(D34EBA9DF4269C69), C(CEA1B16F10EE5F7F), C(8C028F8E8D8B0403),
	C(7D642B194FE3C856), C(1ABAFDA0479469E7), C(17E70DF0EADED31A), C(971E868998BA3C11),
	C(333C110F2D697822), C(1B1C090715313812), C(2986ECAF6AFD11C5), C(30CB10FBDB9B8B20),
	C(2820180838584030), C(41543F156B97A87E), C(3934170D237F682E), C(14100C041C2C2018),
	C(05040301070B0806), C(E98DAC6421AB0745), C(845B7CDF27CAB6F8), C(B3C59A765F0D9729),
	C(80F98B797264EF0B), C(8E537ADD29DCA6F4), C(C9F4473DB3B2F58E), C(4E583A16628AB074),
	C(C3FC413FBDA4E582), C(EBDC593785FCA5B2), C(C4A9B76D1EF84F73), C(D8E04838A895DD90),
	C(67DED6B90877A1B1), C(A2D19573442ABF37), C(6A8326E9A53D1B4C), C(E1D45F358BEAB5BE),
	C(1C49FF55B66D92E3), C(A8D993714A3CAF3B), C(8AF18D7B7C72FF07), C(860A898C839D140F),
	C(A7D596724321B731), C(921A85889FB13417), C(09FF07F6F8E4E30E), C(82A87E2AD6334DFC),
	C(C6F8423EBAAFED84), C(3B65E25E8728CAD9), C(BB9C6927F54C25D2), C(4305CA46CFC00A89),
	C(3C30140C24746028), C(EC89AF6526A00F43), C(D5BDB86805DF676D), C(F899A3613A8C2F5B),
	C(0F0C0503091D180A), C(E2235EC17D1846BC), C(1641F957B87B82EF), C(A97F67D61899FECE),
	C(9A4376D935F086EC), C(257DE8589512FACD), C(9F4775D832FB8EEA), C(E385AA662FBD1749),
	C(AC7B64D71F92F6C8), C(D2E84E3AA683CD9C), C(CF0745C8424B0E8A), C(CCF0443CB4B9FD88),
	C(35CF13FADC908326), C(F462A796C563C453), C(01A6F4A752A551F5), C(C25AB598EF01B477),
	C(7B9729ECBE1A3352), C(62DAD5B80F7CA9B7), C(FC3B54C76F2276A8), C(2C82EFAE6DF619C3),
	C(D0B9BB6902D46F6B), C(7A31DD4BECBF62A7), C(3D96E0AB76D131DD), C(379EE6A978C721D1),
	C(E681A96728B61F4F), C(22281E0A364E503C), C(4601C947C8CB028F), C(1DEF0BF2E4C8C316),
	C(5BEEC2B52C03C199), C(AA886622EE6B0DCC), C(56B332E581497B64), C(719F2FEEB00C235E),
	C(7CC2DFBE1D4699A3), C(87AC7D2BD13845FA), C(BF3E9E81A0E27C21), C(5A4836127EA6906C),
	C(B5369883AEF46C2D), C(776C2D1B41F5D85A), C(3638120E2A627024), C(AF8C6523E96005CA),
	C(06F302F5F1F9FB04), C(4C09CF45C6DD1283), C(A5846321E77615C6), C(D11F4FCE50713E9E),
	C(7039DB49E2A972AB), C(9CB0742CC4097DE8), C(3AC316F9D58D9B2C), C(59BF37E68854636E),
	C(54E2C7B6251ED993), C(88A07828D8255DF0), C(4B5C39176581B872), C(B0329B82A9FF642B),
	C(72682E1A46FED05C), C(9D16808B96AC2C1D), C(21DF1FFEC0BCA33E), C(9812838A91A7241B),
	C(2D241B093F534836), C(CA0346C94540068C), C(A1269487B2D84C35), C(6B25D24EF7984AB9),
	C(42A33EE19D655B7C), C(96B8722ECA1F6DE4), C(53B731E486427362), C(47A73DE09A6E537A),
	C(608B20EBAB2B0B40), C(EA7AAD90D759F447), C(0EAAF1A45BB849FF), C(6678221E5AD2F044),
	C(AB2E9285BCCE5C39), C(FD9DA0603D87275D), C(0000000000000000), C(B1946F25FB5A35DE),
	C(03F701F4F6F2F302), C(12E30EF1EDD5DB1C), C(FE6AA194CB75D45F), C(272C1D0B3145583A),
	C(5CBB34E78F5F6B68), C(BCC99F7556108F23), C(749B2CEFB7072B58), C(E4D05C348CE1BDB8),
	C(F5C4533197C695A6), C(A37761D4168FEEC2), C(B7676DD00AA3CEDA), C(A4229786B5D34433),
	C(9BE5827E6755D719), C(238EEAAD64EB01C9), C(2ED31AFDC9A1BB34), C(8DA47B29DF2E55F6),
	C(F0C0503090CD9DA0), C(D7EC4D3BA188C59A), C(D946BC9FFA308C65), C(3FC715F8D286932A),
	C(F93F57C668297EAE), C(5F4C351379AD986A), C(1E180A06123A3014), C(11140F051B27281E),
	C(F63352C5613466A4), C(5544331177BB8866), C(B6C1997758069F2F), C(91ED847C6943C715),
	C(8FF58E7A7B79F701), C(85FD8878756FE70D), C(EED85A3682F7ADB4), C(6C70241C54C4E048),
	C(DDE44B39AF9ED596), C(2079EB599219F2CB), C(7860281848E8C050), C(1345FA56BF708AE9),
	C(45F6C8B33E39F18D), C(4AFACDB03724E987), C(B4906C24FC513DD8), C(A0806020E07D1DC0),
	C(40F2CBB23932F98B), C(E072AB92D94FE44B), C(15B6F8A34E8971ED), C(E7275DC07A134EBA),
	C(490DCC44C1D61A85), C(F795A66233913751), C(5040301070B08060), C(5EEAC1B42B08C99F),
	C(AE2A9184BBC5543F), C(5211C543D4E72297), C(E576A893DE44EC4D), C(ED2F5BC274055EB6),
	C(7F35DE4AEBB46AA1), C(73CEDABD145B81A9), C(89068C8F8A800C05), C(99B4772DC30275EE),
	C(76CAD9BC135089AF), C(D64AB99CF32D946F), C(DFB5BE6A0BC97761), C(5D1DC040DDFA3A9D),
	C(D41B4CCF577A3698), C(10B2FBA2498279EB), C(BA3A9D80A7E97427), C(6E21D14FF09342BF),
	C(637C211F5DD9F842), C(C50F43CA4C5D1E86), C(3892E3AA71DA39DB), C(5715C642D3EC2A91)
};

static zuint64 const t4[256] = {
	C(BBB96A01BAD3D268), C(E59A66B154FC4D19), C(E26514CD2F71BC93), C(25871B51749CCDB9),
	C(F7A257A453F55102), C(D0D6BE03D3686BB8), C(D6DEB504D26B6FBD), C(B35285FE4DD72964),
	C(FDBA4AAD50F05D0D), C(CF09E063ACE98A26), C(091C96848D8A0E83), C(A5914D1ABFDCC679),
	C(3DA7374D7090DDAD), C(F1AA5CA352F65507), C(7BA417E19AB352C8), C(B55A8EF94CD42D61),
	C(460320ACEA238F65), C(C4E68411D56273A6), C(55CC68C297A466F1), C(DCC6A80DD16E63B2),
	C(AA85D0993355CCFF), C(FBB241AA51F35908), C(C7E20F9C5BED712A), C(F359AE55A6F7A204),
	C(FEBEC120DE7F5F81), C(AD7AA2E548D83D75), C(D729CC7FA8E59A32), C(71BC0AE899B65EC7),
	C(E096E63BDB704B90), C(AC8DDB9E3256C8FA), C(95D11522B7C4E651), C(32B3AACEFC19D72B),
	C(704B7393E338AB48), C(63843BFD9EBF42DC), C(41FC52D091AE7EEF), C(7DAC1CE69BB056CD),
	C(76437894E23BAF4D), C(BDB16106BBD0D66D), C(9B32F1DA41C31958), C(7957E5176EB2A5CB),
	C(F941B35CA5F2AE0B), C(8016564BCB400BC0), C(677FC20C6BBDB1DA), C(59DC7ECC95A26EFB),
	C(E1619F40A1FEBE1F), C(10CBC3E3F308EB18), C(81E12F30B1CEFE4F), C(0C10160E0206080A),
	C(922E675ECC4917DB), C(A26E3F66C45137F3), C(4EE8CF531D277469), C(78A09C6C143C5044),
	C(B0560E73C3582BE8), C(573F9A3463A591F2), C(E69EED3CDA734F95), C(D3D2358E5DE76934),
	C(DFC223805FE1613E), C(F2AED72EDC79578B), C(13CF486E7D87E994), C(94266C59CD4A13DE),
	C(1FDF5E607F81E19E), C(C1EA049B5AEE752F), C(7547F3196CB4ADC1), C(D5DA3E895CE46D31),
	C(08EBEFFFF704FB0C), C(D42D47F2266A98BE), C(38ABB7C7FF1CDB24), C(543B11B9ED2A937E),
	C(4A1336A2E825876F), C(699C26F49DBA4ED3), C(7F5FEE106FB1A1CE), C(03048B8D8E8F028C),
	C(56C8E34F192B647D), C(E7699447A0FDBA1A), C(1AD3DEEAF00DE717), C(113CBA9889861E97),
	C(2278692D0F113C33), C(1238311507091C1B), C(C511FD6AAFEC8629), C(208B9BDBFB10CB30),
	C(3040583808182028), C(7EA8976B153F5441), C(2E687F230D173439), C(18202C1C040C1014),
	C(06080B0701030405), C(4507AB2164AC8DE9), C(F8B6CA27DF7C5B84), C(29970D5F769AC5B3),
	C(0BEF6472798BF980), C(F4A6DC29DD7A538E), C(8EF5B2B33D47F4C9), C(74B08A62163A584E),
	C(82E5A4BD3F41FCC3), C(B2A5FC853759DCEB), C(734FF81E6DB7A9C4), C(90DD95A83848E0D8),
	C(B1A17708B9D6DE67), C(37BF2A447395D1A2), C(4C1B3DA5E926836A), C(BEB5EA8B355FD4E1),
	C(E3926DB655FF491C), C(3BAF3C4A7193D9A8), C(07FF727C7B8DF18A), C(0F149D838C890A86),
	C(31B721437296D5A7), C(1734B19F88851A92), C(0EE3E4F8F607FF09), C(FC4D33D62A7EA882),
	C(84EDAFBA3E42F8C6), C(D9CA28875EE2653B), C(D2254CF527699CBB), C(890AC0CF46CA0543),
	C(286074240C14303C), C(430FA02665AF89EC), C(6D67DF0568B8BDD5), C(5B2F8C3A61A399F8),
	C(0A181D0903050C0F), C(BC46187DC15E23E2), C(EF827BB857F94116), C(CEFE9918D6677FA9),
	C(EC86F035D976439A), C(CDFA129558E87D25), C(EA8EFB32D875479F), C(4917BD2F66AA85E3),
	C(C8F6921FD7647BAC), C(9CCD83A63A4EE8D2), C(8A0E4B42C84507CF), C(88FDB9B43C44F0CC),
	C(268390DCFA13CF35), C(53C463C596A762F4), C(F551A552A7F4A601), C(77B401EF98B55AC2),
	C(52331ABEEC29977B), C(B7A97C0FB8D5DA62), C(A876226FC7543BFC), C(C319F66DAEEF822C),
	C(6B6FD40269BBB9D0), C(A762BFEC4BDD317A), C(DD31D176ABE0963D), C(D121C778A9E69E37),
	C(4F1FB62867A981E6), C(3C504E360A1E2822), C(8F02CBC847C90146), C(16C3C8E4F20BEF1D),
	C(99C1032CB5C2EE5B), C(CC0D6BEE226688AA), C(647B4981E532B356), C(5E230CB0EE2F9F71),
	C(A399461DBEDFC27C), C(FA4538D12B7DAC87), C(217CE2A0819E3EBF), C(6C90A67E1236485A),
	C(2D6CF4AE839836B5), C(5AD8F5411B2D6C77), C(2470622A0E123836), C(CA0560E923658CAF),
	C(04FBF9F1F502F306), C(8312DDC645CF094C), C(C61576E7216384A5), C(9E3E7150CE4F1FD1),
	C(AB72A9E249DB3970), C(E87D09C42C74B09C), C(2C9B8DD5F916C33A), C(6E635488E637BF59),
	C(93D91E25B6C7E254), C(F05D25D82878A088), C(72B8816517395C4B), C(2B64FFA9829B32B0),
	C(5CD0FE461A2E6872), C(1D2CAC968B80169D), C(3EA3BCC0FE1FDF21), C(1B24A7918A831298),
	C(3648533F091B242D), C(8C064045C94603CA), C(354CD8B2879426A1), C(B94A98F74ED2256B),
	C(7C5B659DE13EA342), C(E46D1FCA2E72B896), C(62734286E431B753), C(7A536E9AE03DA747),
	C(400B2BABEB208B60), C(47F459D790AD7AEA), C(FF49B85BA4F1AA0E), C(44F0D25A1E227866),
	C(395CCEBC85922EAB), C(5D27873D60A09DFD), C(0000000000000000), C(DE355AFB256F94B1),
	C(02F3F2F6F401F703), C(1CDBD5EDF10EE312), C(5FD475CB94A16AFE), C(3A5845310B1D2C27),
	C(686B5F8FE734BB5C), C(238F1056759FC9BC), C(582B07B7EF2C9B74), C(B8BDE18C345CD0E4),
	C(A695C6973153C4F5), C(C2EE8F16D46177A3), C(DACEA30AD06D67B7), C(3344D3B5869722A4),
	C(19D755677E82E59B), C(C901EB64ADEA8E23), C(34BBA1C9FD1AD32E), C(F6552EDF297BA48D),
	C(A09DCD903050C0F0), C(9AC588A13B4DECD7), C(658C30FA9FBC46D9), C(2A9386D2F815C73F),
	C(AE7E2968C6573FF9), C(6A98AD7913354C5F), C(14303A12060A181E), C(1E28271B050F1411),
	C(A4663461C55233F6), C(6688BB7711334455), C(2F9F06587799C1B6), C(15C743697C84ED91),
	C(01F7797B7A8EF58F), C(0DE76F757888FD85), C(B4ADF782365AD8EE), C(48E0C4541C24706C),
	C(96D59EAF394BE4DD), C(CBF2199259EB7920), C(50C0E84818286078), C(E98A70BF56FA4513),
	C(8DF1393EB3C8F645), C(87E92437B0CDFA4A), C(D83D51FC246C90B4), C(C01D7DE0206080A0),
	C(8BF93239B2CBF240), C(4BE44FD992AB72E0), C(ED71894EA3F8B615), C(BA4E137AC05D27E7),
	C(851AD6C144CC0D49), C(5137913362A695F7), C(6080B07010304050), C(9FC9082BB4C1EA5E),
	C(3F54C5BB84912AAE), C(9722E7D443C51152), C(4DEC44DE93A876E5), C(B65E0574C25B2FED),
	C(A16AB4EB4ADE357F), C(A9815B14BDDACE73), C(050C808A8F8C0689), C(EE7502C32D77B499),
	C(AF895013BCD9CA76), C(6F942DF39CB94AD6), C(6177C90B6ABEB5DF), C(9D3AFADD40C01D5D),
	C(98367A57CF4C1BD4), C(EB798249A2FBB210), C(2774E9A7809D3ABA), C(BF4293F04FD1216E),
	C(42F8D95D1F217C63), C(861E5D4CCA430FC5), C(DB39DA71AAE39238), C(912AECD342C61557)
};

static zuint64 const t5[256] = {
	C(B9BB016AD3BA68D2), C(9AE5B166FC54194D), C(65E2CD14712F93BC), C(8725511B9C74B9CD),
	C(A2F7A457F5530251), C(D6D003BE68D3B86B), C(DED604B56BD2BD6F), C(52B3FE85D74D6429),
	C(BAFDAD4AF0500D5D), C(09CF63E0E9AC268A), C(1C0984968A8D830E), C(91A51A4DDCBF79C6),
	C(A73D4D379070ADDD), C(AAF1A35CF6520755), C(A47BE117B39AC852), C(5AB5F98ED44C612D),
	C(0346AC2023EA658F), C(E6C4118462D5A673), C(CC55C268A497F166), C(C6DC0DA86ED1B263),
	C(85AA99D05533FFCC), C(B2FBAA41F3510859), C(E2C79C0FED5B2A71), C(59F355AEF7A604A2),
	C(BEFE20C17FDE815F), C(7AADE5A2D848753D), C(29D77FCCE5A8329A), C(BC71E80AB699C75E),
	C(96E03BE670DB904B), C(8DAC9EDB5632FAC8), C(D1952215C4B751E6), C(B332CEAA19FC2BD7),
	C(4B70937338E348AB), C(8463FD3BBF9EDC42), C(FC41D052AE91EF7E), C(AC7DE61CB09BCD56),
	C(437694783BE24DAF), C(B1BD0661D0BB6DD6), C(329BDAF1C3415819), C(577917E5B26ECBA5),
	C(41F95CB3F2A50BAE), C(16804B5640CBC00B), C(7F670CC2BD6BDAB1), C(DC59CC7EA295FB6E),
	C(61E1409FFEA11FBE), C(CB10E3C308F318EB), C(E181302FCEB14FFE), C(100C0E1606020A08),
	C(2E925E6749CCDB17), C(6EA2663F51C4F337), C(E84E53CF271D6974), C(A0786C9C3C144450),
	C(56B0730E58C3E82B), C(3F57349AA563F291), C(9EE63CED73DA954F), C(D2D38E35E75D3469),
	C(C2DF8023E15F3E61), C(AEF22ED779DC8B57), C(CF136E48877D94E9), C(2694596C4ACDDE13),
	C(DF1F605E817F9EE1), C(EAC19B04EE5A2F75), C(477519F3B46CC1AD), C(DAD5893EE45C316D),
	C(EB08FFEF04F70CFB), C(2DD4F2476A26BE98), C(AB38C7B71CFF24DB), C(3B54B9112AED7E93),
	C(134AA23625E86F87), C(9C69F426BA9DD34E), C(5F7F10EEB16FCEA1), C(04038D8B8F8E8C02),
	C(C8564FE32B197D64), C(69E74794FDA01ABA), C(D31AEADE0DF017E7), C(3C1198BA8689971E),
	C(78222D69110F333C), C(3812153109071B1C), C(11C56AFDECAF2986), C(8B20DB9B10FB30CB),
	C(4030385818082820), C(A87E6B973F154154), C(682E237F170D3934), C(20181C2C0C041410),
	C(0806070B03010504), C(074521ABAC64E98D), C(B6F827CA7CDF845B), C(97295F0D9A76B3C5),
	C(EF0B72648B7980F9), C(A6F429DC7ADD8E53), C(F58EB3B2473DC9F4), C(B074628A3A164E58),
	C(E582BDA4413FC3FC), C(A5B285FC5937EBDC), C(4F731EF8B76DC4A9), C(DD90A8954838D8E0),
	C(A1B10877D6B967DE), C(BF37442A9573A2D1), C(1B4CA53D26E96A83), C(B5BE8BEA5F35E1D4),
	C(92E3B66DFF551C49), C(AF3B4A3C9371A8D9), C(FF077C728D7B8AF1), C(140F839D898C860A),
	C(B73143219672A7D5), C(34179FB18588921A), C(E30EF8E407F609FF), C(4DFCD6337E2A82A8),
	C(ED84BAAF423EC6F8), C(CAD98728E25E3B65), C(25D2F54C6927BB9C), C(0A89CFC0CA464305),
	C(60282474140C3C30), C(0F4326A0AF65EC89), C(676D05DFB868D5BD), C(2F5B3A8CA361F899),
	C(180A091D05030F0C), C(46BC7D185EC1E223), C(82EFB87BF9571641), C(FECE189967D6A97F),
	C(86EC35F076D99A43), C(FACD9512E858257D), C(8EEA32FB75D89F47), C(17492FBDAA66E385),
	C(F6C81F9264D7AC7B), C(CD9CA6834E3AD2E8), C(0E8A424B45C8CF07), C(FD88B4B9443CCCF0),
	C(8326DC9013FA35CF), C(C453C563A796F462), C(51F552A5F4A701A6), C(B477EF01B598C25A),
	C(3352BE1A29EC7B97), C(A9B70F7CD5B862DA), C(76A86F2254C7FC3B), C(19C36DF6EFAE2C82),
	C(6F6B02D4BB69D0B9), C(62A7ECBFDD4B7A31), C(31DD76D1E0AB3D96), C(21D178C7E6A9379E),
	C(1F4F28B6A967E681), C(503C364E1E0A2228), C(028FC8CBC9474601), C(C316E4C80BF21DEF),
	C(C1992C03C2B55BEE), C(0DCCEE6B6622AA88), C(7B64814932E556B3), C(235EB00C2FEE719F),
	C(99A31D46DFBE7CC2), C(45FAD1387D2B87AC), C(7C21A0E29E81BF3E), C(906C7EA636125A48),
	C(6C2DAEF49883B536), C(D85A41F52D1B776C), C(70242A62120E3638), C(05CAE9606523AF8C),
	C(FB04F1F902F506F3), C(1283C6DDCF454C09), C(15C6E7766321A584), C(3E9E50714FCED11F),
	C(72ABE2A9DB497039), C(7DE8C409742C9CB0), C(9B2CD58D16F93AC3), C(636E885437E659BF),
	C(D993251EC7B654E2), C(5DF0D825782888A0), C(B872658139174B5C), C(642BA9FF9B82B032),
	C(D05C46FE2E1A7268), C(2C1D96AC808B9D16), C(A33EC0BC1FFE21DF), C(241B91A7838A9812),
	C(48363F531B092D24), C(068C454046C9CA03), C(4C35B2D89487A126), C(4AB9F798D24E6B25),
	C(5B7C9D653EE142A3), C(6DE4CA1F722E96B8), C(7362864231E453B7), C(537A9A6E3DE047A7),
	C(0B40AB2B20EB608B), C(F447D759AD90EA7A), C(49FF5BB8F1A40EAA), C(F0445AD2221E6678),
	C(5C39BCCE9285AB2E), C(275D3D87A060FD9D), C(0000000000000000), C(35DEFB5A6F25B194),
	C(F302F6F201F403F7), C(DB1CEDD50EF112E3), C(D45FCB75A194FE6A), C(583A31451D0B272C),
	C(6B688F5F34E75CBB), C(8F2356109F75BCC9), C(2B58B7072CEF749B), C(BDB88CE15C34E4D0),
	C(95A697C65331F5C4), C(EEC2168F61D4A377), C(CEDA0AA36DD0B767), C(4433B5D39786A422),
	C(D7196755827E9BE5), C(01C964EBEAAD238E), C(BB34C9A11AFD2ED3), C(55F6DF2E7B298DA4),
	C(9DA090CD5030F0C0), C(C59AA1884D3BD7EC), C(8C65FA30BC9FD946), C(932AD28615F83FC7),
	C(7EAE682957C6F93F), C(986A79AD35135F4C), C(3014123A0A061E18), C(281E1B270F051114),
	C(66A4613452C5F633), C(886677BB33115544), C(9F2F58069977B6C1), C(C7156943847C91ED),
	C(F7017B798E7A8FF5), C(E70D756F887885FD), C(ADB482F75A36EED8), C(E04854C4241C6C70),
	C(D596AF9E4B39DDE4), C(F2CB9219EB592079), C(C05048E828187860), C(8AE9BF70FA561345),
	C(F18D3E39C8B345F6), C(E9873724CDB04AFA), C(3DD8FC516C24B490), C(1DC0E07D6020A080),
	C(F98B3932CBB240F2), C(E44BD94FAB92E072), C(71ED4E89F8A315B6), C(4EBA7A135DC0E727),
	C(1A85C1D6CC44490D), C(37513391A662F795), C(806070B030105040), C(C99F2B08C1B45EEA),
	C(543FBBC59184AE2A), C(2297D4E7C5435211), C(EC4DDE44A893E576), C(5EB674055BC2ED2F),
	C(6AA1EBB4DE4A7F35), C(81A9145BDABD73CE), C(0C058A808C8F8906), C(75EEC302772D99B4),
	C(89AF1350D9BC76CA), C(946FF32DB99CD64A), C(77610BC9BE6ADFB5), C(3A9DDDFAC0405D1D),
	C(3698577A4CCFD41B), C(79EB4982FBA210B2), C(7427A7E99D80BA3A), C(42BFF093D14F6E21),
	C(F8425DD9211F637C), C(1E864C5D43CAC50F), C(39DB71DAE3AA3892), C(2A91D3ECC6425715)
};

static zuint64 const t6[256] = {
	C(6A01BBB9D268BAD3), C(66B1E59A4D1954FC), C(14CDE265BC932F71), C(1B512587CDB9749C),
	C(57A4F7A2510253F5), C(BE03D0D66BB8D368), C(B504D6DE6FBDD26B), C(85FEB35229644DD7),
	C(4AADFDBA5D0D50F0), C(E063CF098A26ACE9), C(9684091C0E838D8A), C(4D1AA591C679BFDC),
	C(374D3DA7DDAD7090), C(5CA3F1AA550752F6), C(17E17BA452C89AB3), C(8EF9B55A2D614CD4),
	C(20AC46038F65EA23), C(8411C4E673A6D562), C(68C255CC66F197A4), C(A80DDCC663B2D16E),
	C(D099AA85CCFF3355), C(41AAFBB2590851F3), C(0F9CC7E2712A5BED), C(AE55F359A204A6F7),
	C(C120FEBE5F81DE7F), C(A2E5AD7A3D7548D8), C(CC7FD7299A32A8E5), C(0AE871BC5EC799B6),
	C(E63BE0964B90DB70), C(DB9EAC8DC8FA3256), C(152295D1E651B7C4), C(AACE32B3D72BFC19),
	C(7393704BAB48E338), C(3BFD638442DC9EBF), C(52D041FC7EEF91AE), C(1CE67DAC56CD9BB0),
	C(78947643AF4DE23B), C(6106BDB1D66DBBD0), C(F1DA9B32195841C3), C(E5177957A5CB6EB2),
	C(B35CF941AE0BA5F2), C(564B80160BC0CB40), C(C20C677FB1DA6BBD), C(7ECC59DC6EFB95A2),
	C(9F40E161BE1FA1FE), C(C3E310CBEB18F308), C(2F3081E1FE4FB1CE), C(160E0C10080A0206),
	C(675E922E17DBCC49), C(3F66A26E37F3C451), C(CF534EE874691D27), C(9C6C78A05044143C),
	C(0E73B0562BE8C358), C(9A34573F91F263A5), C(ED3CE69E4F95DA73), C(358ED3D269345DE7),
	C(2380DFC2613E5FE1), C(D72EF2AE578BDC79), C(486E13CFE9947D87), C(6C59942613DECD4A),
	C(5E601FDFE19E7F81), C(049BC1EA752F5AEE), C(F3197547ADC16CB4), C(3E89D5DA6D315CE4),
	C(EFFF08EBFB0CF704), C(47F2D42D98BE266A), C(B7C738ABDB24FF1C), C(11B9543B937EED2A),
	C(36A24A13876FE825), C(26F4699C4ED39DBA), C(EE107F5FA1CE6FB1), C(8B8D0304028C8E8F),
	C(E34F56C8647D192B), C(9447E769BA1AA0FD), C(DEEA1AD3E717F00D), C(BA98113C1E978986),
	C(692D22783C330F11), C(311512381C1B0709), C(FD6AC5118629AFEC), C(9BDB208BCB30FB10),
	C(5838304020280818), C(976B7EA85441153F), C(7F232E6834390D17), C(2C1C18201014040C),
	C(0B07060804050103), C(AB2145078DE964AC), C(CA27F8B65B84DF7C), C(0D5F2997C5B3769A),
	C(64720BEFF980798B), C(DC29F4A6538EDD7A), C(B2B38EF5F4C93D47), C(8A6274B0584E163A),
	C(A4BD82E5FCC33F41), C(FC85B2A5DCEB3759), C(F81E734FA9C46DB7), C(95A890DDE0D83848),
	C(7708B1A1DE67B9D6), C(2A4437BFD1A27395), C(3DA54C1B836AE926), C(EA8BBEB5D4E1355F),
	C(6DB6E392491C55FF), C(3C4A3BAFD9A87193), C(727C07FFF18A7B8D), C(9D830F140A868C89),
	C(214331B7D5A77296), C(B19F17341A928885), C(E4F80EE3FF09F607), C(33D6FC4DA8822A7E),
	C(AFBA84EDF8C63E42), C(2887D9CA653B5EE2), C(4CF5D2259CBB2769), C(C0CF890A054346CA),
	C(74242860303C0C14), C(A026430F89EC65AF), C(DF056D67BDD568B8), C(8C3A5B2F99F861A3),
	C(1D090A180C0F0305), C(187DBC4623E2C15E), C(7BB8EF82411657F9), C(9918CEFE7FA9D667),
	C(F035EC86439AD976), C(1295CDFA7D2558E8), C(FB32EA8E479FD875), C(BD2F491785E366AA),
	C(921FC8F67BACD764), C(83A69CCDE8D23A4E), C(4B428A0E07CFC845), C(B9B488FDF0CC3C44),
	C(90DC2683CF35FA13), C(63C553C462F496A7), C(A552F551A601A7F4), C(01EF77B45AC298B5),
	C(1ABE5233977BEC29), C(7C0FB7A9DA62B8D5), C(226FA8763BFCC754), C(F66DC319822CAEEF),
	C(D4026B6FB9D069BB), C(BFECA762317A4BDD), C(D176DD31963DABE0), C(C778D1219E37A9E6),
	C(B6284F1F81E667A9), C(4E363C5028220A1E), C(CBC88F02014647C9), C(C8E416C3EF1DF20B),
	C(032C99C1EE5BB5C2), C(6BEECC0D88AA2266), C(4981647BB356E532), C(0CB05E239F71EE2F),
	C(461DA399C27CBEDF), C(38D1FA45AC872B7D), C(E2A0217C3EBF819E), C(A67E6C90485A1236),
	C(F4AE2D6C36B58398), C(F5415AD86C771B2D), C(622A247038360E12), C(60E9CA058CAF2365),
	C(F9F104FBF306F502), C(DDC68312094C45CF), C(76E7C61584A52163), C(71509E3E1FD1CE4F),
	C(A9E2AB72397049DB), C(09C4E87DB09C2C74), C(8DD52C9BC33AF916), C(54886E63BF59E637),
	C(1E2593D9E254B6C7), C(25D8F05DA0882878), C(816572B85C4B1739), C(FFA92B6432B0829B),
	C(FE465CD068721A2E), C(AC961D2C169D8B80), C(BCC03EA3DF21FE1F), C(A7911B2412988A83),
	C(533F3648242D091B), C(40458C0603CAC946), C(D8B2354C26A18794), C(98F7B94A256B4ED2),
	C(659D7C5BA342E13E), C(1FCAE46DB8962E72), C(42866273B753E431), C(6E9A7A53A747E03D),
	C(2BAB400B8B60EB20), C(59D747F47AEA90AD), C(B85BFF49AA0EA4F1), C(D25A44F078661E22),
	C(CEBC395C2EAB8592), C(873D5D279DFD60A0), C(0000000000000000), C(5AFBDE3594B1256F),
	C(F2F602F3F703F401), C(D5ED1CDBE312F10E), C(75CB5FD46AFE94A1), C(45313A582C270B1D),
	C(5F8F686BBB5CE734), C(1056238FC9BC759F), C(07B7582B9B74EF2C), C(E18CB8BDD0E4345C),
	C(C697A695C4F53153), C(8F16C2EE77A3D461), C(A30ADACE67B7D06D), C(D3B5334422A48697),
	C(556719D7E59B7E82), C(EB64C9018E23ADEA), C(A1C934BBD32EFD1A), C(2EDFF655A48D297B),
	C(CD90A09DC0F03050), C(88A19AC5ECD73B4D), C(30FA658C46D99FBC), C(86D22A93C73FF815),
	C(2968AE7E3FF9C657), C(AD796A984C5F1335), C(3A121430181E060A), C(271B1E281411050F),
	C(3461A46633F6C552), C(BB77668844551133), C(06582F9FC1B67799), C(436915C7ED917C84),
	C(797B01F7F58F7A8E), C(6F750DE7FD857888), C(F782B4ADD8EE365A), C(C45448E0706C1C24),
	C(9EAF96D5E4DD394B), C(1992CBF2792059EB), C(E84850C060781828), C(70BFE98A451356FA),
	C(393E8DF1F645B3C8), C(243787E9FA4AB0CD), C(51FCD83D90B4246C), C(7DE0C01D80A02060),
	C(32398BF9F240B2CB), C(4FD94BE472E092AB), C(894EED71B615A3F8), C(137ABA4E27E7C05D),
	C(D6C1851A0D4944CC), C(9133513795F762A6), C(B070608040501030), C(082B9FC9EA5EB4C1),
	C(C5BB3F542AAE8491), C(E7D49722115243C5), C(44DE4DEC76E593A8), C(0574B65E2FEDC25B),
	C(B4EBA16A357F4ADE), C(5B14A981CE73BDDA), C(808A050C06898F8C), C(02C3EE75B4992D77),
	C(5013AF89CA76BCD9), C(2DF36F944AD69CB9), C(C90B6177B5DF6ABE), C(FADD9D3A1D5D40C0),
	C(7A5798361BD4CF4C), C(8249EB79B210A2FB), C(E9A727743ABA809D), C(93F0BF42216E4FD1),
	C(D95D42F87C631F21), C(5D4C861E0FC5CA43), C(DA71DB399238AAE3), C(ECD3912A155742C6)
};

static zuint64 const t7[256] = {
	C(016AB9BB68D2D3BA), C(B1669AE5194DFC54), C(CD1465E293BC712F), C(511B8725B9CD9C74),
	C(A457A2F70251F553), C(03BED6D0B86B68D3), C(04B5DED6BD6F6BD2), C(FE8552B36429D74D),
	C(AD4ABAFD0D5DF050), C(63E009CF268AE9AC), C(84961C09830E8A8D), C(1A4D91A579C6DCBF),
	C(4D37A73DADDD9070), C(A35CAAF10755F652), C(E117A47BC852B39A), C(F98E5AB5612DD44C),
	C(AC200346658F23EA), C(1184E6C4A67362D5), C(C268CC55F166A497), C(0DA8C6DCB2636ED1),
	C(99D085AAFFCC5533), C(AA41B2FB0859F351), C(9C0FE2C72A71ED5B), C(55AE59F304A2F7A6),
	C(20C1BEFE815F7FDE), C(E5A27AAD753DD848), C(7FCC29D7329AE5A8), C(E80ABC71C75EB699),
	C(3BE696E0904B70DB), C(9EDB8DACFAC85632), C(2215D19551E6C4B7), C(CEAAB3322BD719FC),
	C(93734B7048AB38E3), C(FD3B8463DC42BF9E), C(D052FC41EF7EAE91), C(E61CAC7DCD56B09B),
	C(947843764DAF3BE2), C(0661B1BD6DD6D0BB), C(DAF1329B5819C341), C(17E55779CBA5B26E),
	C(5CB341F90BAEF2A5), C(4B561680C00B40CB), C(0CC27F67DAB1BD6B), C(CC7EDC59FB6EA295),
	C(409F61E11FBEFEA1), C(E3C3CB1018EB08F3), C(302FE1814FFECEB1), C(0E16100C0A080602),
	C(5E672E92DB1749CC), C(663F6EA2F33751C4), C(53CFE84E6974271D), C(6C9CA07844503C14),
	C(730E56B0E82B58C3), C(349A3F57F291A563), C(3CED9EE6954F73DA), C(8E35D2D33469E75D),
	C(8023C2DF3E61E15F), C(2ED7AEF28B5779DC), C(6E48CF1394E9877D), C(596C2694DE134ACD),
	C(605EDF1F9EE1817F), C(9B04EAC12F75EE5A), C(19F34775C1ADB46C), C(893EDAD5316DE45C),
	C(FFEFEB080CFB04F7), C(F2472DD4BE986A26), C(C7B7AB3824DB1CFF), C(B9113B547E932AED),
	C(A236134A6F8725E8), C(F4269C69D34EBA9D), C(10EE5F7FCEA1B16F), C(8D8B04038C028F8E),
	C(4FE3C8567D642B19), C(479469E71ABAFDA0), C(EADED31A17E70DF0), C(98BA3C11971E8689),
	C(2D697822333C110F), C(153138121B1C0907), C(6AFD11C52986ECAF), C(DB9B8B2030CB10FB),
	C(3858403028201808), C(6B97A87E41543F15), C(237F682E3934170D), C(1C2C201814100C04),
	C(070B080605040301), C(21AB0745E98DAC64), C(27CAB6F8845B7CDF), C(5F0D9729B3C59A76),
	C(7264EF0B80F98B79), C(29DCA6F48E537ADD), C(B3B2F58EC9F4473D), C(628AB0744E583A16),
	C(BDA4E582C3FC413F), C(85FCA5B2EBDC5937), C(1EF84F73C4A9B76D), C(A895DD90D8E04838),
	C(0877A1B167DED6B9), C(442ABF37A2D19573), C(A53D1B4C6A8326E9), C(8BEAB5BEE1D45F35),
	C(B66D92E31C49FF55), C(4A3CAF3BA8D99371), C(7C72FF078AF18D7B), C(839D140F860A898C),
	C(4321B731A7D59672), C(9FB13417921A8588), C(F8E4E30E09FF07F6), C(D6334DFC82A87E2A),
	C(BAAFED84C6F8423E), C(8728CAD93B65E25E), C(F54C25D2BB9C6927), C(CFC00A894305CA46),
	C(247460283C30140C), C(26A00F43EC89AF65), C(05DF676DD5BDB868), C(3A8C2F5BF899A361),
	C(091D180A0F0C0503), C(7D1846BCE2235EC1), C(B87B82EF1641F957), C(1899FECEA97F67D6),
	C(35F086EC9A4376D9), C(9512FACD257DE858), C(32FB8EEA9F4775D8), C(2FBD1749E385AA66),
	C(1F92F6C8AC7B64D7), C(A683CD9CD2E84E3A), C(424B0E8ACF0745C8), C(B4B9FD88CCF0443C),
	C(DC90832635CF13FA), C(C563C453F462A796), C(52A551F501A6F4A7), C(EF01B477C25AB598),
	C(BE1A33527B9729EC), C(0F7CA9B762DAD5B8), C(6F2276A8FC3B54C7), C(6DF619C32C82EFAE),
	C(02D46F6BD0B9BB69), C(ECBF62A77A31DD4B), C(76D131DD3D96E0AB), C(78C721D1379EE6A9),
	C(28B61F4FE681A967), C(364E503C22281E0A), C(C8CB028F4601C947), C(E4C8C3161DEF0BF2),
	C(2C03C1995BEEC2B5), C(EE6B0DCCAA886622), C(81497B6456B332E5), C(B00C235E719F2FEE),
	C(1D4699A37CC2DFBE), C(D13845FA87AC7D2B), C(A0E27C21BF3E9E81), C(7EA6906C5A483612),
	C(AEF46C2DB5369883), C(41F5D85A776C2D1B), C(2A6270243638120E), C(E96005CAAF8C6523),
	C(F1F9FB0406F302F5), C(C6DD12834C09CF45), C(E77615C6A5846321), C(50713E9ED11F4FCE),
	C(E2A972AB7039DB49), C(C4097DE89CB0742C), C(D58D9B2C3AC316F9), C(8854636E59BF37E6),
	C(251ED99354E2C7B6), C(D8255DF088A07828), C(6581B8724B5C3917), C(A9FF642BB0329B82),
	C(46FED05C72682E1A), C(96AC2C1D9D16808B), C(C0BCA33E21DF1FFE), C(91A7241B9812838A),
	C(3F5348362D241B09), C(4540068CCA0346C9), C(B2D84C35A1269487), C(F7984AB96B25D24E),
	C(9D655B7C42A33EE1), C(CA1F6DE496B8722E), C(8642736253B731E4), C(9A6E537A47A73DE0),
	C(AB2B0B40608B20EB), C(D759F447EA7AAD90), C(5BB849FF0EAAF1A4), C(5AD2F0446678221E),
	C(BCCE5C39AB2E9285), C(3D87275DFD9DA060), C(0000000000000000), C(FB5A35DEB1946F25),
	C(F6F2F30203F701F4), C(EDD5DB1C12E30EF1), C(CB75D45FFE6AA194), C(3145583A272C1D0B),
	C(8F5F6B685CBB34E7), C(56108F23BCC99F75), C(B7072B58749B2CEF), C(8CE1BDB8E4D05C34),
	C(97C695A6F5C45331), C(168FEEC2A37761D4), C(0AA3CEDAB7676DD0), C(B5D34433A4229786),
	C(6755D7199BE5827E), C(64EB01C9238EEAAD), C(C9A1BB342ED31AFD), C(DF2E55F68DA47B29),
	C(90CD9DA0F0C05030), C(A188C59AD7EC4D3B), C(FA308C65D946BC9F), C(D286932A3FC715F8),
	C(68297EAEF93F57C6), C(79AD986A5F4C3513), C(123A30141E180A06), C(1B27281E11140F05),
	C(613466A4F63352C5), C(77BB886655443311), C(58069F2FB6C19977), C(6943C71591ED847C),
	C(7B79F7018FF58E7A), C(756FE70D85FD8878), C(82F7ADB4EED85A36), C(54C4E0486C70241C),
	C(AF9ED596DDE44B39), C(9219F2CB2079EB59), C(48E8C05078602818), C(BF708AE91345FA56),
	C(3E39F18D45F6C8B3), C(3724E9874AFACDB0), C(FC513DD8B4906C24), C(E07D1DC0A0806020),
	C(3932F98B40F2CBB2), C(D94FE44BE072AB92), C(4E8971ED15B6F8A3), C(7A134EBAE7275DC0),
	C(C1D61A85490DCC44), C(33913751F795A662), C(70B0806050403010), C(2B08C99F5EEAC1B4),
	C(BBC5543FAE2A9184), C(D4E722975211C543), C(DE44EC4DE576A893), C(74055EB6ED2F5BC2),
	C(EBB46AA17F35DE4A), C(145B81A973CEDABD), C(8A800C0589068C8F), C(C30275EE99B4772D),
	C(135089AF76CAD9BC), C(F32D946FD64AB99C), C(0BC97761DFB5BE6A), C(DDFA3A9D5D1DC040),
	C(577A3698D41B4CCF), C(498279EB10B2FBA2), C(A7E97427BA3A9D80), C(F09342BF6E21D14F),
	C(5DD9F842637C211F), C(4C5D1E86C50F43CA), C(71DA39DB3892E3AA), C(D3EC2A915715C642)
};

static zuint64 const c[8 + 1] = {
	C(BA542F7453D3D24D), C(50AC8DBF70529A4C), C(EAD597D133515BA6),
	C(DE48A899DB32B7FC), C(E39E919BE2BB416E), C(A5CB6B95A1F3B102),
	C(CCC41D14C363DA5D), C(5FDC7DCD7F5A6C5C), C(F726FFEDE89D6F8E)
};


CIPHER_KHAZAD_API
void khazad_set_key(Khazad *object, zuint8 const *key, zusize key_size)
	{
	zuint r;
	zuint64 k2, k1;

	k2 =	(((zuint64)z_uint32_big_endian(key[0])) << 32) |
		  (zuint64)z_uint32_big_endian(key[1]);

	k1 =	(((zuint64)z_uint32_big_endian(key[2])) << 32) |
		  (zuint64)z_uint32_big_endian(key[3]);

	/*---------------------------.
	| Setup the enciphering key. |
	'---------------------------*/
	for (r = 0; r <= 8; r++)
		{
		object->e[r] =
		t0[ k1 >> 56	    ] ^
		t1[(k1 >> 48) & 0xFF] ^
		t2[(k1 >> 40) & 0xFF] ^
		t3[(k1 >> 32) & 0xFF] ^
		t4[(k1 >> 24) & 0xFF] ^
		t5[(k1 >> 16) & 0xFF] ^
		t6[(k1 >>  8) & 0xFF] ^
		t7[ k1	      & 0xFF] ^ c[r] ^ k2;

		k2 = k1;
		k1 = object->e[r];
		}

	/*---------------------------.
	| Setup the deciphering key. |
	'---------------------------*/
	object->d[0] = object->e[8];

	for (r = 1; r < 8; r++)
		{
		k1 = object->e[8 - r];

		object->d[r] =
		t0[t7[ k1 >> 56	       ] & 0xFF] ^
		t1[t7[(k1 >> 48) & 0xFF] & 0xFF] ^
		t2[t7[(k1 >> 40) & 0xFF] & 0xFF] ^
		t3[t7[(k1 >> 32) & 0xFF] & 0xFF] ^
		t4[t7[(k1 >> 24) & 0xFF] & 0xFF] ^
		t5[t7[(k1 >> 16) & 0xFF] & 0xFF] ^
		t6[t7[(k1 >>  8) & 0xFF] & 0xFF] ^
		t7[t7[ k1	 & 0xFF] & 0xFF];
		}

	object->d[8] = object->e[0];
	}


static void cipher(
	zuint64 const* round_key,
	zuint64 const* block,
	zusize	       block_size,
	zuint64*       output
)
	{
	zuint r;
	zuint64 s;

	for (block_size >>= 3; block_size; block_size--)
		{
		s = z_uint64_big_endian(*block++) ^ *round_key;

		for (r = 1; r < 8; r++)
			{
			s =
			t0[ s >> 56	   ] ^
			t1[(s >> 48) & 0xFF] ^
			t2[(s >> 40) & 0xFF] ^
			t3[(s >> 32) & 0xFF] ^
			t4[(s >> 24) & 0xFF] ^
			t5[(s >> 16) & 0xFF] ^
			t6[(s >>  8) & 0xFF] ^
			t7[ s	     & 0xFF] ^ round_key[r];
			}

		s =
		(t0[ s >> 56	    ] & C(FF00000000000000)) ^
		(t1[(s >> 48) & 0xFF] & C(00FF000000000000)) ^
		(t2[(s >> 40) & 0xFF] & C(0000FF0000000000)) ^
		(t3[(s >> 32) & 0xFF] & C(000000FF00000000)) ^
		(t4[(s >> 24) & 0xFF] & C(00000000FF000000)) ^
		(t5[(s >> 16) & 0xFF] & C(0000000000FF0000)) ^
		(t6[(s >>  8) & 0xFF] & C(000000000000FF00)) ^
		(t7[ s	      & 0xFF] & C(00000000000000FF)) ^ round_key[8];

		*output++ = z_uint64_big_endian(s);
		}
	}


CIPHER_KHAZAD_API
void khazad_encipher(Khazad *object, zuint64 const *block, zusize block_size, zuint64 *output)
	{cipher(object->e, block, block_size, output);}


CIPHER_KHAZAD_API
void khazad_decipher(Khazad *object, zuint64 const *block, zusize block_size, zuint64 *output)
	{cipher(object->d, block, block_size, output);}


#if defined(CIPHER_KHAZAD_BUILD_ABI) || defined(CIPHER_KHAZAD_BUILD_MODULE_ABI)

	CIPHER_KHAZAD_ABI ZCipherABI const abi_cipher_khazad = {
		/* test_key		 */ NULL,
		/* set_key		 */ (ZCipherSetKey )khazad_set_key,
		/* encipher		 */ (ZCipherProcess)khazad_encipher,
		/* decipher		 */ (ZCipherProcess)khazad_decipher,
		/* enciphering_size	 */ NULL,
		/* deciphering_size	 */ NULL,
		/* instance_size	 */ sizeof(Khazad),
		/* key_minimum_size	 */ KHAZAD_KEY_SIZE,
		/* key_maximum_size	 */ KHAZAD_KEY_SIZE,
		/* key_word_size	 */ KHAZAD_KEY_SIZE,
		/* enciphering_word_size */ KHAZAD_WORD_SIZE,
		/* deciphering_word_size */ KHAZAD_WORD_SIZE,
		/* features		 */ FALSE
	};

#endif

#if defined(CIPHER_KHAZAD_BUILD_MODULE_ABI)

#	include <Z/ABIs/generic/module.h>

	static ZModuleUnit const unit = {
		"Khazad", "Khazad", Z_VERSION(1, 0, 0), &abi_cipher_khazad
	};

	static ZModuleDomain const domain = {"Cipher", Z_VERSION(1, 0, 0), 1, &unit};
	Z_API_WEAK_EXPORT ZModuleABI const __module_abi__ = {1, &domain};

#endif


/* Khazad.c EOF */
